#include "stm32f10x.h"                  // Device header
#include"Delay.h"
#include "OLED.h"
#include "AD.h"

float Voltage0,Voltage1,Voltage4;
int main(void)
{ OLED_Init();
  AD_Init();
	OLED_ShowString(1, 1, "AD0:");
	OLED_ShowString(2, 1, "AD1:");
	OLED_ShowString(3, 1, "AD4:");
	OLED_ShowString(1, 10, "0.00V");
	OLED_ShowString(2, 10, "0.00V");
	OLED_ShowString(3, 10, "0.00V");
	while(1)
  { 
		OLED_ShowNum(1,5,AD_Value[0],4);
		OLED_ShowNum(2,5,AD_Value[1],4);
		OLED_ShowNum(3,5,AD_Value[2],4);
    Voltage0=(float)AD_Value[0]/4095*3.3;
		OLED_ShowNum(1,10,Voltage0,1);	
		OLED_ShowNum(1,12,(uint16_t)(Voltage0*100)%100,2);
		Voltage1=(float)AD_Value[1]/4095*3.3;
		OLED_ShowNum(2,10,Voltage1,1);	
		OLED_ShowNum(2,12,(uint16_t)(Voltage1*100)%100,2);
		Voltage4=(float)AD_Value[2]/4095*3.3;
		OLED_ShowNum(3,10,Voltage4,1);	
		OLED_ShowNum(3,12,(uint16_t)(Voltage4*100)%100,2);		
		Delay_ms(100);
  }
}

